require("lualib_bundle");
__TS__SourceMapTraceBack(debug.getinfo(1).short_src, {["4"] = 1,["5"] = 1,["6"] = 2,["7"] = 2,["8"] = 3,["9"] = 3,["10"] = 5,["11"] = 5,["12"] = 5,["14"] = 10,["15"] = 12,["16"] = 13,["17"] = 14,["18"] = 15,["19"] = 16,["20"] = 17,["21"] = 18,["22"] = 19,["24"] = 15,["25"] = 14,["26"] = 9,["27"] = 27,["28"] = 28,["29"] = 29,["30"] = 30,["31"] = 31,["32"] = 32,["33"] = 33,["34"] = 34,["35"] = 35,["36"] = 37,["37"] = 37,["38"] = 37,["39"] = 37,["40"] = 38,["41"] = 39,["42"] = 40,["43"] = 41,["44"] = 42,["45"] = 43,["46"] = 44,["47"] = 45,["49"] = 34,["51"] = 27,["52"] = 7,["53"] = 5});
local ____exports = {}
local ____trigger = require("solar.w3ts.handles.trigger")
local Trigger = ____trigger.Trigger
local ____DataBase = require("solar.common.DataBase")
local DataBase = ____DataBase.default
local ____SelectUtil = require("solar.util.SelectUtil")
local SelectUtil = ____SelectUtil.default
____exports.default = __TS__Class()
local OrderUnitMove2NextRectOnEnterRectState = ____exports.default
OrderUnitMove2NextRectOnEnterRectState.name = "OrderUnitMove2NextRectOnEnterRectState"
function OrderUnitMove2NextRectOnEnterRectState.prototype.____constructor(self)
    self:init()
    local trigger = __TS__New(Trigger)
    trigger:registerTimerEvent(10, true)
    trigger:addAction(function()
        SelectUtil.forAllEnemyUnits(function(____, unit)
            local solarData = DataBase:getUnitSolarData(unit)
            local nextX = solarData.OrderUnitMove2NextRectOnEnterRectState_nextX
            if nextX then
                IssuePointOrder(unit, solarData.OrderUnitMove2NextRectOnEnterRectState_order, nextX, solarData.OrderUnitMove2NextRectOnEnterRectState_nextY)
            end
        end)
    end)
end
function OrderUnitMove2NextRectOnEnterRectState.prototype.init(self)
    for rectValName in pairs(____exports.default.config) do
        local data = ____exports.default.config[rectValName]
        local trigger = __TS__New(Trigger)
        local rectRegion = CreateRegion()
        RegionAddRect(rectRegion, _G[rectValName])
        trigger:registerEnterRegion(rectRegion, nil)
        trigger:addAction(function()
            local unit = GetTriggerUnit()
            if IsUnitEnemy(
                unit,
                Player(0)
            ) then
                local rectHandle = _G[data.nextRectValName]
                local nextX = GetRectCenterX(rectHandle)
                local nextY = GetRectCenterY(rectHandle)
                IssuePointOrder(unit, data.order, nextX, nextY)
                local solarData = DataBase:getUnitSolarData(unit)
                solarData.OrderUnitMove2NextRectOnEnterRectState_nextX = nextX
                solarData.OrderUnitMove2NextRectOnEnterRectState_nextY = nextY
                solarData.OrderUnitMove2NextRectOnEnterRectState_order = data.order
            end
        end)
    end
end
OrderUnitMove2NextRectOnEnterRectState.config = {}
____exports.default = OrderUnitMove2NextRectOnEnterRectState
return ____exports
